#include <stdio.h>

int main(int argc, const char *argv[]) {
    
    int n, i, cnt, ans;

    while (1) {
        scanf("%d", &n);

        if (n == 0) break;

        ans = 0;
        cnt = n;
        i = 1;
        while (cnt - i >= 0) {
            ans += i * i;
            cnt -= i; i++; 
        }

        if (cnt > 0) {
            ans += cnt * i;
        }

        printf("%d %d\n", n, ans);
    }

    return 0;
}
